import React, { useEffect,useState } from 'react';
import { Form,
    Input, 
    Select,
    Drawer,
    Button,
    PageHeader,
    Divider,
    Row,
    Col,
    Checkbox,
    Tag,
    Table,
    Space,
   } from 'antd';
  import moment from 'moment';
  import {getDictCode,getDictCodeLabel} from '@/utils/DataDictUtils';
  import { EditOutlined } from '@ant-design/icons';
  import '../index.less';

  const FormItem = Form.Item;
  const {TextArea} =  Input;
  const { Option } = Select;
  const dateFormat = 'YYYY-MM-DD';

const ViewForm = props => {
    const { visible, current, onCancel } = props;
    const [regionData, setRegionData] = useState(null);
    const [friendlyName, setFriendlyName] = useState(null);
    useEffect(()=>{
      
      if(current && visible){
        setRegionData(current.region);
        setFriendlyName(current.friendlyName);
         
      }

    },[visible]);

    return (
        <>
        <Drawer
          title="查看用户"
          width={720}
          onClose={onCancel}
          visible={visible}
          bodyStyle={{ paddingBottom: 80 }}
          footer={
            <div
              style={{
                textAlign: 'right',
              }}
            >
              <Button onClick={onCancel} style={{ marginRight: 8 }}>
                关闭
              </Button>
              
            </div>
          }
        >
          <Form labelCol={{span: 4,}} wrapperCol={{span: 14,}} layout="horizontal" >
            <Row>
              <Col span={18}>
                <FormItem label='登录名称'  >
                    {current && current.loginName? current.loginName:''}
                </FormItem>
              </Col>
              <Col span={18}>
                <FormItem label='用户名称'  >
                    {current && current.userName}
                </FormItem>
              </Col>
              <Col span={18}>
                <FormItem label='角色'  >
                    {current && current.roleName ? current.roleName:''}
                </FormItem>
              </Col>
          </Row>
          </Form>
        </Drawer>
        </>
    );
};

export default ViewForm;